<?php
namespace PsiFramework\Applications\Bibliotheque\Classes\Model;

import("Classes.Model.Object");

use \PsiFramework\Classes\Model\Object;

/**
 * Bibliotheque
 * Gestion de ma bibliothèque
 *
 * @author Rémi San
 * @version beta
 */

/**
 * Classe d'un Type
 *
 * @package Model
 */
class Type extends Object
{

    protected /*int*/         $_id ;
    protected /*string*/      $_nom;
    protected /*Type*/        $_parent;
    protected /*Type[]*/      $_children;

    /**
     * Constructeur
     *
     * @param       int      $id                  L'identifiant du Type
     * @param       string   $nom                 Le nom du Type
     * @param       Type     $nom                 Le Type parent du Type
     */
    public function __construct(
        /*int*/ $id=null,
        /*string*/ $nom=null,
        /*Type*/ $parent=null
    )
    {
        $this->_id = $id ;
        $this->_nom = $nom ;
        $this->_parent = $parent ;
        $this->_children = array();
    }

    public function getId()
    {
        return $this->_id ;
    }

    public function setId($id)
    {
        $this->_id = $id ;
    }

    public function getNom()
    {
        return $this->_nom ;
    }

    public function setNom($nom)
    {
        $this->_nom = $nom ;
    }

    public function getParent()
    {
        return $this->_parent ;
    }

    public function setParent($parent)
    {
        $this->_parent = $parent ;
    }

    public function getChildren()
    {
        return $this->_children ;
    }

    public function setChildren($children)
    {
        $this->_children = $children ;
    }

    public function addChild($child)
    {
        $this->_children[] = $child ;
    }

    public function toString()
    {
        return $this->_nom ;
    }
}
